﻿using System;

namespace SilverTwitterSearch
{
    /// <summary>
    /// Settings for searching with a specific geocode.
    /// </summary>
    public struct Geocode
    {
        #region Properties
        /// <summary>
        /// Gets or sets the latitude.
        /// </summary>
        public long Latitude 
        { 
            get; 
            set; 
        }

        /// <summary>
        /// Gets or sets he longitude.
        /// </summary>
        public long Longitude 
        { 
            get; 
            set; 
        }

        /// <summary>
        /// Gets or sets the radius.
        /// </summary>
        public long Radius 
        { 
            get; 
            set; 
        }

        /// <summary>
        /// Gets or sets the unit used to describe the radius.
        /// </summary>
        public GeocodeUnit Unit 
        { 
            get; 
            set; 
        }
        #endregion

        #region Parameter-String
        /// <summary>
        /// Returns a URI-parameter-string representing the current set of Geocode options.
        /// </summary>
        /// <returns>Parameter-String</returns>
        public override string ToString()
        {
            return String.Format(
                "{0},{1},{2}{3}", 
                this.Latitude, 
                this.Longitude, 
                this.Radius, 
                Unit == GeocodeUnit.Kilometers ? "km" : "mi");
        }
        #endregion
    }
}